package com.bugsnag.ohos;

/**
 * Provides information about the last launch of the application, if there was one.
 *
 * @since 2021-07-02
 */
public class LastRunInfo {
    /**
     * The number times the app has consecutively crashed during its launch period.
     */
    int consecutiveLaunchCrashes;

    /**
     * Whether the last app run ended with a crash, or was abnormally terminated by the system.
     */
    boolean crashed;

    /**
     * True if the previous app run ended with a crash during its launch period.
     */
    boolean crashedDuringLaunch;

    /**
     * constructor
     *
     * @param consecutiveLaunchCrashes
     * @param crashed
     * @param crashedDuringLaunch
     */
    public LastRunInfo(int consecutiveLaunchCrashes, boolean crashed, boolean crashedDuringLaunch) {
        this.consecutiveLaunchCrashes = consecutiveLaunchCrashes;
        this.crashed = crashed;
        this.crashedDuringLaunch = crashedDuringLaunch;
    }

    public int getConsecutiveLaunchCrashes() {
        return consecutiveLaunchCrashes;
    }

    public void setConsecutiveLaunchCrashes(int consecutiveLaunchCrashes) {
        this.consecutiveLaunchCrashes = consecutiveLaunchCrashes;
    }

    public boolean getCrashed() {
        return crashed;
    }

    public void setCrashed(Boolean crashed) {
        this.crashed = crashed;
    }

    public boolean getCrashedDuringLaunch() {
        return crashedDuringLaunch;
    }

    public void setCrashedDuringLaunch(boolean crashedDuringLaunch) {
        this.crashedDuringLaunch = crashedDuringLaunch;
    }

    @Override
    public String toString() {
        return "LastRunInfo("
            + "consecutiveLaunchCrashes=" + consecutiveLaunchCrashes
            + ", crashed=" + crashed + ", crashedDuringLaunch="
            + crashedDuringLaunch
            + ')';
    }
}
